<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>

	<title>Search Flight</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link href="../../style/style.css" rel="stylesheet" type="text/css" />

</h:head>

<h:body>

	<div class="main">

		<div class="header">

			<div class="header_resize">

				<div class="menu">

					<ul>

						<li><a href="../index.xhtml"><span>Home</span></a></li>

						<li><a href="basic.xhtml" class="active"><span>Basic
									Product</span></a></li>

						<li><a href="../packet/packet.xhtml"><span>Travel
									Packet</span></a></li>

					</ul>

				</div>

			</div>

		</div>

		<div class="body">

			<div class="body_resize">

				<div class="left">

					<h2>
						Search <span>Flight</span>
					</h2>

					<h:form id="form">



						<p:panel>
							<h:panelGrid columns="2" id="flightGrid">

								<h:outputLabel for="airline">Airline:</h:outputLabel>
								<p:inputText id="airline"
									value="#{flightBean.searchFlight.airline}" />

								<h:outputLabel for="departure">Departure:</h:outputLabel>
								<p:inputText id="departure"
									value="#{flightBean.searchFlight.departure}" />

								<h:outputLabel for="departure_airport">Departure Airport:</h:outputLabel>
								<p:inputText id="departure_airport"
									value="#{flightBean.searchFlight.departure_airport}" />

								<h:outputLabel for="destination">Destination:</h:outputLabel>
								<p:inputText id="destination"
									value="#{flightBean.searchFlight.destination}" />

								<h:outputLabel for="destination_airport">Destination Airport:</h:outputLabel>
								<p:inputText id="destination_airport"
									value="#{flightBean.searchFlight.destination_airport}" />

								<h:outputLabel for="minPrice">Min Price:</h:outputLabel>
								<p:inputText id="minPrice"
									value="#{flightBean.searchFlight.minPrice}" />

								<h:outputLabel for="maxPrice">Max Price:</h:outputLabel>
								<p:inputText id="maxPrice"
									value="#{flightBean.searchFlight.maxPrice}" />

								<h3>FromDateTime</h3>
								<p:calendar value="#{flightBean.searchFlight.fromFlightDate}"
									pattern="MM/dd/yyyy HH:mm" />

								<h3>ToDateTime</h3>
								<p:calendar value="#{flightBean.searchFlight.toFlightDate}"
									pattern="MM/dd/yyyy HH:mm" />

							</h:panelGrid>
							<p:commandButton value="Find Flight" update="form"
								action="#{flightBean.find}" />
							<p:commandButton value="Update Flight" update="form" />

						</p:panel>

						<p:dataTable var="flight" value="#{flightBean.flightList}"
							id="flightList" editable="true">

							<f:facet name="header">  
            FLights found  
        </f:facet>

							<p:ajax event="rowEdit" listener="#{flightBean.update}"
								update="flightList" />
							<p:ajax event="rowEditCancel" listener="#{flightBean.delete}"
								update="flightList" />

							<p:column headerText="Airline" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.airline}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{flight.airline}" style="width:100%" />
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Departure" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.departure}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText readonly="#{flight.departure}" />
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Departure Airport" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.departure_airport}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{flight.departure_airport}"
											style="width:100%" />
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Destination" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.destination}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText readonly="#{flight.destination}"/>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Destination Airport" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.destination_airport}" />
									</f:facet>
									<f:facet name="input">
										<h:inputText value="#{flight.destination_airport}"
											style="width:100%" />
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Price" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.price}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{flight.price}" style="width:100%" />
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Date" style="width:12%">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{flight.flightDate}" />
									</f:facet>
									<f:facet name="input">
										<h3>DateTime</h3>
										<p:calendar value="#{flight.flightDate}"
											pattern="MM/dd/yyyy HH:mm" />
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column style="width:6%">
								<p:rowEditor />
							</p:column>

						</p:dataTable>

					</h:form>

					<h:link outcome="basic" value="back" />

				</div>

				<div class="right">

					<h2>
						Sidebar<span> Menu</span>
					</h2>

					<ul>

						<li><a href="#"> Home</a></li>

						<li><a href="#">Most boughted</a></li>

						<li><a href="#">Top destinations</a></li>

					</ul>

				</div>

				<div class="clr"></div>

			</div>

		</div>

		<div class="footer">

			<div class="footer_resize">

				<p>TravelDream</p>

			</div>

			<div class="clr"></div>

		</div>

	</div>

</h:body>

</html>